package com.agile.java_seetaface;


import java.lang.reflect.Field;

/**
 * @Author ChenZhangKun
 * @Date 2020/4/27 9:47
 */
public class GetCore {
    public native String getName();

    public native void out();

    public static native int getAge();

    public static void main(String[] args) {
        System.loadLibrary("GetCore");
        System.out.println(Runtime.getRuntime().availableProcessors());
        new GetCore().out();
    }
    static {
        String separator = System.getProperty("path.separator");
        String sysLib = System.getProperty("java.library.path");
        if (sysLib.endsWith(separator)) {
            System.setProperty("java.library.path", sysLib + "C:\\Users\\李赛飞\\Desktop");
        } else {
            System.setProperty("java.library.path", sysLib + separator + "C:\\Users\\李赛飞\\Desktop");
        }
        try {
            //使java.library.path生效
            Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
            sysPathsField.setAccessible(true);
            sysPathsField.set(null, null);
        } catch (NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}